﻿using System;
using RaptorEngine;
using RaptorEngine.Components;
using RaptorEngine.Components.Drawable;
using RaptorEngine.Components.CollidableComponent;
using OilRigSumoWrestlers.Actions;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace OilRigSumoWrestlers.Entities
{
    public class PlayerCharacter : Entity
    {
        private Movable _movable;
        private Collidable _collidable;

        public PlayerCharacter(String modelPath)
            :base ()
        {
            _movable = new Movable(this, GameConstant.PLAYER_MASS);
            AddComponent(_movable);
            AddComponent(new DrawableModel(
                this,
                GameEngine.Instance.Load<Model>(modelPath),
                new BasicEffect(GameEngine.Instance.Render.GraphicsDevice)));
            AddComponent(new Collidable(
                this,
                new NormalBounce(1),
                GameEngine.Instance.Load<Model>("Models/Sphere/sphere_mapped"),
                true,
                (int)CollisionType.Player));
            _collidable = (Collidable)base.GetComponent(ComponentType.Collidable);
            _collidable.BoundingVolumes["default"].CollisionTypes.Add((int)CollisionType.Bounce);
            _collidable.AddBoundingSphere("push", Position, Vector3.Right * 2, 1, (int)CollisionType.Push, new PushAction());
            _collidable.BoundingVolumes["push"].IsActive = false;
			AddComponent(new ParticleComp(this, ComponentType.Particle, "smoke"));
        } 
    }
}
